/**
* @file tuya_device.c
* @author www.tuya.com
* @brief  demo for SDK WiFi & BLE for BK7231N, hardware: BK7231N NANO SoC board
* @version 0.1
* @date 2021-08-12
*
* @copyright Copyright (c) tuya.inc 2021
*
*/
#define _TUYA_DEVICE_GLOBAL
#include "tuya_device.h"
#include "uart_common.h"
#include "uni_log.h"

/**
* @brief Pre-initialization of device functions
*
* @param[in] none
* @return none
*/
VOID pre_device_init(VOID)
{

    PR_DEBUG("%s", tuya_iot_get_sdk_info());
    PR_DEBUG("%s:%s", APP_BIN_NAME, USER_SW_VER);
    SetLogManageAttr(TY_LOG_LEVEL_NOTICE);
}

/**
* @brief mf_user_callback
*
* @param[in] none
* @return none
*/
VOID mf_user_callback(VOID)
{

    return;
}

/**
* @brief Application initialization
*
* @param[in] none
* @return none
*/
VOID app_init(VOID)
{
    return;
}

/**
* @brief For production testing
*
* @param[in] none
* @return BOOL_T
*/
BOOL_T gpio_test(IN CONST CHAR_T *in, OUT CHAR_T *out)
{
    //return gpio_test_all(in, out);
    return true;
}

/**
* @brief device initialize
*
* @param[in] none
* @return OK/ERROR
*/
OPERATE_RET device_init(VOID)
{

    OPERATE_RET op_ret = OPRT_OK;
    //op_ret = uart_task_init(TYU_RATE_115200, FIRMWARE_KEY, strlen(FIRMWARE_KEY), TRUE);
    op_ret = uart_task_init(TYU_RATE_115200, FIRMWARE_KEY, strlen(FIRMWARE_KEY), FALSE);
    if (op_ret != OPRT_OK) {
        return op_ret;
    }
    return OPRT_OK;
}

OPERATE_RET user_product_test_cb(USHORT_T cmd, UCHAR_T *data, UINT_T len, OUT UCHAR_T **ret_data, OUT USHORT_T *ret_len)
{
    return OPRT_OK;
}

/**
* @brief Apply the pre-initialization operation
*
* @param[in] none
* @return none
*/
VOID pre_app_init(VOID)
{
    return;
}
OPERATE_RET mf_user_product_test_cb(USHORT_T cmd, UCHAR_T *data, UINT_T len, OUT UCHAR_T **ret_data, OUT USHORT_T *ret_len)
{
    return OPRT_OK;
}

VOID mf_user_enter_callback(VOID)
{
    return;
}

VOID mf_user_pre_gpio_test_cb(VOID)
{
    return;
}
BOOL_T gpio_test_all_cb(VOID)
{
    return TRUE;

}
